package com.jeesite.modules.ocr.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.ocr.base.IOcrAlgorithmConfig;

/**
 * OCR算法配置Entity
 * @author 姚海陆,长春叭哥
 * @version 2024-07-28
 */
@Table(name="ocr_algorithm_config", alias="a", label="OCR算法配置信息", columns={
		@Column(name="algorithm_config_id", attrName="algorithmConfigId", label="算法配置编码", isPK=true),
		@Column(name="name", attrName="name", label="算法名称", queryType=QueryType.LIKE),
		@Column(name="model_algorithm", attrName="modelAlgorithm", label="模型算法"),
		@Column(name="model_version", attrName="modelVersion", label="模型版本"),
		@Column(name="description", attrName="description", label="算法描述", isQuery=false),
		@Column(name="ocr_char_scores", attrName="ocrCharScores", label="字符阈值", isQuery=false, isUpdateForce=true),
		@Column(name="ocr_box_score", attrName="ocrBoxScore", label="边框阈值", isQuery=false, isUpdateForce=true),
		@Column(name="ocr_angle_score", attrName="ocrAngleScore", label="角度阈值", isQuery=false, isUpdateForce=true),
		@Column(name="num_thread", attrName="numThread", label="CPU 核心数量", isQuery=false, isUpdateForce=true),
		@Column(name="gpu_index", attrName="gpuIndex", label="GPU索引", isQuery=false, isUpdateForce=true),
		@Column(name="padding", attrName="padding", label="图像外接白框", isQuery=false, isUpdateForce=true),
		@Column(name="max_side_len", attrName="maxSideLen", label="按图像长边进行总体缩放", isQuery=false, isUpdateForce=true),
		@Column(name="box_score_thresh", attrName="boxScoreThresh", label="文字框置信度门限", isQuery=false, isUpdateForce=true),
		@Column(name="box_thresh", attrName="boxThresh", label="框的score阈值", isQuery=false, isUpdateForce=true),
		@Column(name="un_clip_ratio", attrName="unClipRatio", label="单个文字框大小倍率", isQuery=false, isUpdateForce=true),
		@Column(name="do_angle", attrName="doAngle", label="文字方向检测", isQuery=false),
		@Column(name="most_angle", attrName="mostAngle", label="角度投票", isQuery=false),
		@Column(name="total_weight", attrName="totalWeight", label="总权重", isQuery=false, isUpdateForce=true),
		@Column(name="keywords_weight", attrName="keywordsWeight", label="关键词匹配权重", isQuery=false, isUpdateForce=true),
		@Column(name="large_model_weight", attrName="largeModelWeight", label="大模型提示词权重", isQuery=false, isUpdateForce=true),
		@Column(name="similarity_weight", attrName="similarityWeight", label="图片相似度权重", isQuery=false, isUpdateForce=true),
		@Column(name="classification_weight", attrName="classificationWeight", label="图像分类模型权重", isQuery=false, isUpdateForce=true),
		@Column(name="fixed_region_weight", attrName="fixedRegionWeight", label="特征区域权重", isQuery=false, isUpdateForce=true),
		@Column(name="custom_training_weight", attrName="customTrainingWeight", label="自训练模型权重", isQuery=false, isUpdateForce=true),
		@Column(name="pre_back_ground_color", attrName="preBackGroundColor", label="预览图背景色", isQuery=false),
		@Column(name="pre_font_name", attrName="preFontName", label="预览图字体", isQuery=false),
		@Column(name="pre_font_color", attrName="preFontColor", label="预览图字体颜色", isQuery=false),
		@Column(name="pre_font_size", attrName="preFontSize", label="预览图字体大小", isQuery=false),
		@Column(name="pre_font_style", attrName="preFontStyle", label="预览图字体样式", isQuery=false),
		@Column(name="pre_rectangle_color", attrName="preRectangleColor", label="预览图边框颜色", isQuery=false),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class OcrAlgorithmConfig extends DataEntity<OcrAlgorithmConfig> implements IOcrAlgorithmConfig{
	
	private static final long serialVersionUID = 1L;
	private String algorithmConfigId;		// 算法配置编码
	private String name;		// 算法名称
	private String modelAlgorithm;		// 模型算法
	private String modelVersion;		// 模型版本
	private String description;		// 算法描述
	private Double ocrCharScores;		// 字符阈值
	private Double ocrBoxScore;		// 边框阈值
	private Double ocrAngleScore;		// 角度阈值
	private Long numThread;		// CPU 核心数量
	private Integer gpuIndex;		// GPU索引
	private Integer padding;		// 图像外接白框
	private Integer maxSideLen;		// 按图像长边进行总体缩放
	private Double boxScoreThresh;		// 文字框置信度门限
	private Double boxThresh;		// 框的score阈值
	private Double unClipRatio;		// 单个文字框大小倍率
	private Integer doAngle;		// 文字方向检测
	private Integer mostAngle;		// 角度投票
	private Double totalWeight;		// 总权重
	private Double keywordsWeight;		// 关键词匹配权重
	private Double largeModelWeight;		// 大模型提示词权重
	private Double similarityWeight;		// 图片相似度权重
	private Double classificationWeight;		// 图像分类模型权重
	private Double fixedRegionWeight;		// 特征区域权重
	private Double customTrainingWeight;		// 自训练模型权重
	private String preBackGroundColor;		// 预览图背景色
	private String preFontName;		// 预览图字体
	private String preFontColor;		// 预览图字体颜色
	private String preFontSize;		// 预览图字体大小
	private String preFontStyle;		// 预览图字体样式
	private String preRectangleColor;		// 预览图边框颜色

	public OcrAlgorithmConfig() {
		this(null);
	}
	
	public OcrAlgorithmConfig(String id){
		super(id);
	}
	
	public String getAlgorithmConfigId() {
		return algorithmConfigId;
	}

	public void setAlgorithmConfigId(String algorithmConfigId) {
		this.algorithmConfigId = algorithmConfigId;
	}
	
	@NotBlank(message="算法名称不能为空")
	@Size(min=0, max=200, message="算法名称长度不能超过 200 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Size(min=0, max=200, message="模型算法长度不能超过 200 个字符")
	public String getModelAlgorithm() {
		return modelAlgorithm;
	}

	public void setModelAlgorithm(String modelAlgorithm) {
		this.modelAlgorithm = modelAlgorithm;
	}
	
	@NotBlank(message="模型版本不能为空")
	@Size(min=0, max=64, message="模型版本长度不能超过 64 个字符")
	public String getModelVersion() {
		return modelVersion;
	}

	public void setModelVersion(String modelVersion) {
		this.modelVersion = modelVersion;
	}
	
	@Size(min=0, max=500, message="算法描述长度不能超过 500 个字符")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	public Double getOcrCharScores() {
		return ocrCharScores;
	}

	public void setOcrCharScores(Double ocrCharScores) {
		this.ocrCharScores = ocrCharScores;
	}
	
	public Double getOcrBoxScore() {
		return ocrBoxScore;
	}

	public void setOcrBoxScore(Double ocrBoxScore) {
		this.ocrBoxScore = ocrBoxScore;
	}
	
	public Double getOcrAngleScore() {
		return ocrAngleScore;
	}

	public void setOcrAngleScore(Double ocrAngleScore) {
		this.ocrAngleScore = ocrAngleScore;
	}
	
	public Long getNumThread() {
		return numThread;
	}

	public void setNumThread(Long numThread) {
		this.numThread = numThread;
	}
	
	public Integer getGpuIndex() {
		return gpuIndex;
	}

	public void setGpuIndex(Integer gpuIndex) {
		this.gpuIndex = gpuIndex;
	}
	
	public Integer getPadding() {
		return padding;
	}

	public void setPadding(Integer padding) {
		this.padding = padding;
	}
	
	public Integer getMaxSideLen() {
		return maxSideLen;
	}

	public void setMaxSideLen(Integer maxSideLen) {
		this.maxSideLen = maxSideLen;
	}
	
	public Double getBoxScoreThresh() {
		return boxScoreThresh;
	}

	public void setBoxScoreThresh(Double boxScoreThresh) {
		this.boxScoreThresh = boxScoreThresh;
	}
	
	public Double getBoxThresh() {
		return boxThresh;
	}

	public void setBoxThresh(Double boxThresh) {
		this.boxThresh = boxThresh;
	}
	
	public Double getUnClipRatio() {
		return unClipRatio;
	}

	public void setUnClipRatio(Double unClipRatio) {
		this.unClipRatio = unClipRatio;
	}
	
	@NotNull(message="文字方向检测不能为空")
	public Integer getDoAngle() {
		return doAngle;
	}

	public void setDoAngle(Integer doAngle) {
		this.doAngle = doAngle;
	}
	
	@NotNull(message="角度投票不能为空")
	public Integer getMostAngle() {
		return mostAngle;
	}

	public void setMostAngle(Integer mostAngle) {
		this.mostAngle = mostAngle;
	}
	
	public Double getTotalWeight() {
		return totalWeight;
	}

	public void setTotalWeight(Double totalWeight) {
		this.totalWeight = totalWeight;
	}
	
	public Double getKeywordsWeight() {
		return keywordsWeight;
	}

	public void setKeywordsWeight(Double keywordsWeight) {
		this.keywordsWeight = keywordsWeight;
	}
	
	public Double getLargeModelWeight() {
		return largeModelWeight;
	}

	public void setLargeModelWeight(Double largeModelWeight) {
		this.largeModelWeight = largeModelWeight;
	}
	
	public Double getSimilarityWeight() {
		return similarityWeight;
	}

	public void setSimilarityWeight(Double similarityWeight) {
		this.similarityWeight = similarityWeight;
	}
	
	public Double getClassificationWeight() {
		return classificationWeight;
	}

	public void setClassificationWeight(Double classificationWeight) {
		this.classificationWeight = classificationWeight;
	}
	
	public Double getFixedRegionWeight() {
		return fixedRegionWeight;
	}

	public void setFixedRegionWeight(Double fixedRegionWeight) {
		this.fixedRegionWeight = fixedRegionWeight;
	}
	
	public Double getCustomTrainingWeight() {
		return customTrainingWeight;
	}

	public void setCustomTrainingWeight(Double customTrainingWeight) {
		this.customTrainingWeight = customTrainingWeight;
	}
	
	@Size(min=0, max=64, message="预览图背景色长度不能超过 64 个字符")
	public String getPreBackGroundColor() {
		return preBackGroundColor;
	}

	public void setPreBackGroundColor(String preBackGroundColor) {
		this.preBackGroundColor = preBackGroundColor;
	}
	
	@Size(min=0, max=100, message="预览图字体长度不能超过 100 个字符")
	public String getPreFontName() {
		return preFontName;
	}

	public void setPreFontName(String preFontName) {
		this.preFontName = preFontName;
	}
	
	@Size(min=0, max=64, message="预览图字体颜色长度不能超过 64 个字符")
	public String getPreFontColor() {
		return preFontColor;
	}

	public void setPreFontColor(String preFontColor) {
		this.preFontColor = preFontColor;
	}
	
	@Size(min=0, max=64, message="预览图字体大小长度不能超过 64 个字符")
	public String getPreFontSize() {
		return preFontSize;
	}

	public void setPreFontSize(String preFontSize) {
		this.preFontSize = preFontSize;
	}
	
	@Size(min=0, max=64, message="预览图字体样式长度不能超过 64 个字符")
	public String getPreFontStyle() {
		return preFontStyle;
	}

	public void setPreFontStyle(String preFontStyle) {
		this.preFontStyle = preFontStyle;
	}
	
	@Size(min=0, max=64, message="预览图边框颜色长度不能超过 64 个字符")
	public String getPreRectangleColor() {
		return preRectangleColor;
	}

	public void setPreRectangleColor(String preRectangleColor) {
		this.preRectangleColor = preRectangleColor;
	}
	
}